package org.visionlibrary.image.colormodel;

import java.awt.Point;
import java.awt.color.ColorSpace;
import java.awt.image.ColorModel;

import javax.media.jai.TiledImage;

public interface ColorConverter {
	/**
	 * Converts pixel color in given image color space to desired color space.
	 * This method uses source image to determine from which color model
	 * convert.
	 * 
	 * @param src
	 *            Source image from which Color Space is taken.
	 * @param pixel
	 *            Point determining which pixels color is converted.
	 * 
	 * @return Color in desired color model.
	 */
	float[] convert(TiledImage src, Point pixel);

	/**
	 * Converts pixel color in given image color space to desired color space.
	 * 
	 * @param src
	 *            Source image from which Color Space is taken.
	 * @param pixelx
	 *            Coordinate x of the source image from which color will be
	 *            taken.
	 * @param pixely
	 *            Coordinate y of the source image from which color will be
	 *            taken.
	 * 
	 * @return Color in desired color model.
	 */
	float[] convert(TiledImage src, int pixelx, int pixely);

	/**
	 * Converts pixel color in given image color space to desired color space.
	 * 
	 * @param cm
	 *            Specified color model from which color will be converted.
	 * @param values
	 *            Array containing color in given color model. This color will
	 *            be converted.
	 * 
	 * @return Color in desired color model.
	 */
	float[] convert(ColorModel cm, float[] values);

	/**
	 * Converts pixel color in given image color space to desired color space.
	 * 
	 * @param cs
	 *            Color space from which color will be converted.
	 * @param values
	 *            Array containing color in given color model. This color will
	 *            be converted.
	 * @return Color in desired color model.
	 */
	float[] convert(ColorSpace cs, float[] values);
}
